Skip to content

fix(assets-controllers): only seed mUSD on chains configured in NetworkController#8684

Draft
salimtb wants to merge 1 commit intomainfrom
fix/tokens-controller-musd-seed-only-configured-chains
Draft

fix(assets-controllers): only seed mUSD on chains configured in NetworkController#8684
salimtb wants to merge 1 commit intomainfrom
fix/tokens-controller-musd-seed-only-configured-chains

Conversation

@salimtb
Copy link
Copy Markdown
Contributor

@salimtb salimtb commented May 4, 2026

…rkController

TokensController previously seeded mUSD into allTokens for every chain in MUSD_SUPPORTED_CHAIN_IDS regardless of whether NetworkController had actually configured that chain. This caused state updates with chainIds that downstream subscribers (e.g. TokenRatesController) could not resolve.

Look up the configured chain set via the new NetworkController:getState allowed action and intersect it with MUSD_SUPPORTED_CHAIN_IDS before seeding. The existing NetworkController:networkAdded and NetworkController:stateChange subscribers continue to re-run seeding so newly added supported chains are picked up automatically.

The test harness now registers a NetworkController:getState handler returning all three supported chains by default, with an opt-in configuredChainIds option (incl. null for missing networkConfigurationsByChainId) to drive the new behavior in tests.

Explanation

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

…rkController

`TokensController` previously seeded mUSD into `allTokens` for every chain
in `MUSD_SUPPORTED_CHAIN_IDS` regardless of whether `NetworkController`
had actually configured that chain. This caused state updates with
chainIds that downstream subscribers (e.g. `TokenRatesController`) could
not resolve.

Look up the configured chain set via the new `NetworkController:getState`
allowed action and intersect it with `MUSD_SUPPORTED_CHAIN_IDS` before
seeding. The existing `NetworkController:networkAdded` and
`NetworkController:stateChange` subscribers continue to re-run seeding so
newly added supported chains are picked up automatically.

The test harness now registers a `NetworkController:getState` handler
returning all three supported chains by default, with an opt-in
`configuredChainIds` option (incl. `null` for missing
`networkConfigurationsByChainId`) to drive the new behavior in tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant